import { stringify } from 'qs';
import request from '../utils/request';

export async function saveOrUpdateCoupon(params) {
  return request(
    `/api/web/pluginCoupon/savePluginCoupon?${stringify(params)}`,{
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function listPluginCoupon(params) {
  return request(`/api/web/pluginCoupon/listPluginCoupon?${stringify(params)}`);
}

export async function delPluginCoupon(params) {
  return request(`/api/web/pluginCoupon/delPluginCoupon?${stringify(params)}`);
}

export async function checkUserList(params) {
  return request(`/api/web/userDetails/listWriterOff?${stringify(params)}`);
}

export async function getPluginCouponById(params) {
  return request(`/api/web/pluginCoupon/getPluginCouponById?${stringify(params)}`);
}

export async function loadCouponResultChart(params) {
  return request(`/api/web/pluginCouponResult/getCouponResultUseDetailsChartInfoById?${stringify(params)}`);
}

export async function listPluginCouponResult(params) {
  return request(`/api/web/pluginCouponResult/listPluginCouponResult?${stringify(params)}`);
}
